<template>
    <div class="check">
        <dialog-spot-infos
                :spot-info="spotInfo"
                >
        </dialog-spot-infos>
    </div>
</template>

<script>
    import DialogSpotInfos from '../../components/dialogModel/SpotInfo.vue';
    export default {
        name: 'spot-detail',
        props: {
            params: {
                type: Object,
                default: () => {
                    return {}
                }
            },
            value: {
                type: String,
                default: ''
            }
        },
        components: {
            DialogSpotInfos
        },
        data() {
            return {
                spotInfo: {},
                spotApi: 'express/spot'
            }
        },
        watch: {
            spotInfo: function (val) {
                this.$emit('dialogTitle',this.spotInfo.name);
            }
        },
        computed: {
            // model: function (value) {
            //     return this.params.model
            // },
            id: function (value) {
                return this.params.id
            }
        },
        created() {
            this.getSpotInfo();
        },
        methods: {
            getSpotInfo() {
                this.$http.get(this.spotApi + '/' + this.id)
                    .then((res) => {
                        this.spotInfo = res.data.data;

                    })
                    .catch((error) => {
                        if (error.response.data.msg) {
                            this.$message.error(error.response.data.msg);
                        } else {
                            this.$message.error('请求错误：' + error.response.status);
                        }
                    });
            }
        }
    }
</script>

<style scoped>

</style>
